﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace FsAddInManager
{
    [Transaction(TransactionMode.Manual)]
    public class FsAddinManagerSetting : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            RibbonPanel ribbonPanel =  null;
            List<RibbonPanel> listPanel = commandData.Application.GetRibbonPanels();
            foreach (RibbonPanel panel in listPanel)
            {
                if (panel.Name ==  "Debug") // RibbonPanel的Name
                {
                    ribbonPanel = panel;
                    break;
                }
            }

            SettingForm form = new SettingForm(ribbonPanel);
            if (DialogResult.OK != form.ShowDialog())
            {
                return Result.Cancelled;
            }



            return Result.Succeeded;
        }
    }
}
